package com.hq.config;

import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.naming.AuthenticationException;
/*全局异常处理机制*/
@ControllerAdvice
public class ShiroException {
    @ExceptionHandler(AuthorizationException.class)
    public String authZ(){
        return "没有访问权限";
    }
    @ExceptionHandler(AuthenticationException.class)
    public String authC(){
        return "身份验证异常";
    }
    @ExceptionHandler(Exception.class)
    public String getException(){
        return "身份验证异常";
    }
}
